﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Discount.aspx.cs" Inherits="famails.BackEnd.Customer.Discount" MasterPageFile="~/Master.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%; padding: 10px;">
        <!--start content 01-->
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="border: 1px solid #333; margin-bottom: 10px; padding: 0px;">
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 10px 20px; background: #000; color: #fff; font-size: 18px; font-weight: bold; position: relative;">
                Thêm mới thẻ khuyến mãi
            </div>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px">
                <asp:Panel Visible="false" ID="pnError" runat="server">
                    <div class="error-box round col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto; padding: 10px;">
                        <asp:Label ID="lblError" runat="server" Text=""></asp:Label>
                    </div>
                </asp:Panel>
                <asp:Panel Visible="false" ID="pnSuccess" runat="server">
                    <div class="confirmation-box round col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto; padding: 10px;">
                        <asp:Label ID="lblSuccess" runat="server" Text=""></asp:Label>
                    </div>
                </asp:Panel>
            </div>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto; padding: 10px;">
                <asp:HiddenField runat="server" ID="hdfDiscountId" />
                <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="padding: 10px;">
                    <div class="col-md-1 col-lg-1 col-sm-3 col-xs-3" style="padding: 5px; line-height: 30px;">
                        Sự kiện
                    </div>
                    <div class="col-md-5 col-lg-5 col-sm-9 col-xs-9" style="padding: 5px;">
                        <asp:TextBox runat="server" ID="txtName" class="form-control" type="text" placeholder="Tên sự kiện giảm giá" Style="border-radius: 0px; border: 1px solid #333;" />
                    </div>
                    <div class="col-md-3 col-xs-12" style="padding: 5px;">
                        <div class="col-md-6 col-xs-6" style="padding:0px;">
                            <asp:RadioButton runat="server" ID="rdValue" type="radio" Checked="true" onclick="change_ico(this.value);" GroupName="DiscountType" value="0" Style="margin-right: 10px;" />
                            <label style="line-height: 30px;">Trị giá</label>
                        </div>
                        <div class="col-md-6 col-xs-6" style="padding:0px;">
                            <asp:RadioButton runat="server" ID="rdPer" type="radio" GroupName="DiscountType" onclick="change_ico(this.value);" Style="margin-right: 10px;" value="1" />
                            <label style="line-height: 30px;">Phần trăm</label>
                        </div>
                    </div>
                    <div class="col-md-3 col-xs-12" style="padding: 5px;">
                        <div class="input-group">
                            <asp:TextBox runat="server" ID="txtDiscount" class="form-control" type="text" Style="text-align: right; border-radius: 0px; border: 1px solid #333;" />
                            <span class="input-group-addon" style="background: #fff; border-radius: 0px; border: 1px solid #333; border-left: 0px;">VNĐ</span>
                        </div>
                    </div>
                </div>
                <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="padding: 10px;">
                    <div class="col-md-1 col-lg-1 col-sm-4 col-xs-4" style="padding: 5px; line-height: 27px;">
                        Bắt đầu
                    </div>
                    <div class="col-md-2 col-lg-2 col-sm-8 col-xs-8" style="padding: 5px;">
                        <div id="txtFromDate"></div>
                        <asp:HiddenField runat="server" ID="fromdate"></asp:HiddenField>
                    </div>
                    <div class="col-md-1 col-lg-1 col-sm-4 col-xs-4" style="padding: 5px; line-height: 27px;">
                        Kết thúc
                    </div>
                    <div class="col-md-2 col-lg-2 col-sm-8 col-xs-8" style="padding: 5px;">
                        <div id="txtToDate"></div>
                        <asp:HiddenField runat="server" ID="todate"></asp:HiddenField>
                    </div>
                    <div class="col-md-6 col-lg-6 col-sm-12 col-xs-12" style="padding: 5px; line-height: 30px;">
                        <div class="col-md-4 col-xs-12" style="padding:0px;">
                            Đơn hàng áp dụng
                        </div>
                        <div class="col-md-6 col-xs-12" style="padding:5px 0px;">
                            <asp:TextBox runat="server" ID="txtMinAmount" TextMode="Number" class="form-control" type="number" placeholder="Giá trị tối thiểu" Style="border-radius: 0px; border: 1px solid #333;" />
                        </div>
                        <div class="col-md-2 col-xs-12" style="padding:5px 0px;">
                            <asp:TextBox runat="server" TextMode="Number" ID="txtNumberOfCode" class="form-control" type="number" placeholder="Số lượng" Style="border-radius: 0px; border: 1px solid #333;" />
                        </div>
                    </div>
                    <div class="col-md-5 col-lg-5 col-sm-12 col-xs-12" style="padding: 0px; padding-top: 20px;">
                        <asp:TextBox Rows="6" ReadOnly="true" TextMode="MultiLine" runat="server" ID="txtCode" class="form-control" Style="resize: none; border-radius: 0px; border: 1px solid #333;" placeholder="Ghi chú cho khuyến mãi"></asp:TextBox>
                    </div>
                    <div class="col-md-2 col-lg-2 col-sm-12 col-xs-12" style="padding: 5px; padding-top: 20px;text-align:center;">
                        <button id="Button3" validationgroup="CheckInput_Email" runat="server" class="btn btn-default" style="border: 1px solid #fff; float: left; background: #333; color: #fff; text-align: center; padding: 6px 15px;margin:0px auto; border-radius: 0px;"
                            onserverclick="btnGenerate_Click">
                            <i style="margin-right: 10px;" class="fa fa-flash"></i>Phát sinh mã
                        </button>
                    </div>
                    <div class="col-md-5 col-lg-5 col-sm-12 col-xs-12" style="padding: 0px; padding-top: 20px;">
                        <asp:TextBox Rows="6" TextMode="MultiLine" runat="server" ID="txtNotes" class="form-control" Style="resize: none; border-radius: 0px; border: 1px solid #333;" placeholder="Ghi chú cho khuyến mãi"></asp:TextBox>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto; padding: 5px;">
                        <button id="Button1" validationgroup="CheckInput_Email" runat="server" class="btn col-xs-6 col-lg-1 col-md-2 col-sm-3" style="border: 1px solid #fff; float: left; background: #333; color: #fff; text-align: center; padding: 6px 15px; border-radius: 0px;"
                            onserverclick="btnAdd_Click">
                            <i style="margin-right: 10px;" class="fa fa-save"></i>Lưu
                        </button>
                        <button id="Button2" validationgroup="CheckInput_Email" runat="server" class="btn col-xs-6 col-lg-2 col-md-2 col-sm-3" style="border: 1px solid #fff; float: left; background: #333; color: #fff; text-align: center; padding: 6px 15px; border-radius: 0px;"
                            onserverclick="btnRefesh_Click">
                            <i style="margin-right: 10px;" class="fa fa-refresh"></i>Nhập lại
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        jQuery(function ($) {
            $("#txtFromDate").jqxDateTimeInput({ width: '120px', height: '25px' });
            $("#txtToDate").jqxDateTimeInput({ width: '120px', height: '25px' });

            if ($('#ContentPlaceHolder1_fromdate').val() + "" != "") {
                $('#txtFromDate').jqxDateTimeInput('val', $('#ContentPlaceHolder1_fromdate').val());
            }
            //else $('#ContentPlaceHolder1_fromdate').val($("#txtFromDate").jqxDateTimeInput("getText"));

            $('#txtFromDate').on('valuechanged', function (event) {
                $('#ContentPlaceHolder1_fromdate').val($("#txtFromDate").jqxDateTimeInput("getText"));
            });

            if ($('#ContentPlaceHolder1_todate').val() + "" != "") {
                $('#txtToDate').jqxDateTimeInput('val', $('#ContentPlaceHolder1_todate').val());
            }
            //else                $('#ContentPlaceHolder1_todate').val($("#txtToDate").jqxDateTimeInput("getText"));
            $('#txtToDate').on('valuechanged', function (event) {
                $('#ContentPlaceHolder1_todate').val($("#txtToDate").jqxDateTimeInput("getText"));
            });
        });

        function change_ico(a) {
            if (a == 0) {
                $('.input-group-addon').html('VNĐ');
            }
            else {
                $('.input-group-addon').html(' % ');
            }

        }
    </script>

</asp:Content>
